<template>
	<div class="list">
		<myHeader></myHeader>
		<div class="content container">
			<div class="content-left">
				<list :list=list></list>
			</div>
			<div class="content-right">
			</div>
		</div>
	</div>
</template>

<script>
import { articleApi } from '@/plugins/api'
import { dateTime } from '@/plugins/filters'

export default {
	name: 'index.vue',
	data () {
		return {
			list: []
		}
	},
	async asyncData (centent) {
		let params = {
			currentPage: 1,
			pageSize: 10,
			columnName: centent.route.params.name
		}
		var { err, data } = await articleApi.getPage(params)
		if (err) {
			return false
		}
		data.list.forEach(item => {
			let con1 = decodeURI(item.content)
			let con2 = con1.replace(/<.+?>/g, '')
			let con3 = con2.replace(/\s/ig, '')
			item.content = con3.substring(0, 60)
			item.created_time = dateTime(item.created_time)
		})
		console.log(data.list)
		let list = data.list
		return { list }
	}
}
</script>

<style scoped lang="less">
.content {
	margin-top: 10px;
	overflow: hidden;
	padding-bottom: 1000px;

	.content-left {
		width: 790px;
		float: left;
	}

	.content-right {
		width: 410px;
		float: right;
	}
}
</style>
